﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DBLayer;
using System.Data;
using System.Data.SqlClient;

namespace BALayer
{
    public class DBHinhThucKiemTra
    {
        DAL db = null;
        public DBHinhThucKiemTra()
        {
            db = new DAL();
        }
        //Lay Hinh Thuc Kiem Tra
        public DataSet LayHinhThucKiemTra()
        {
            return db.ExecuteQueryDataSet("Select * From HinhThucKiemTra", CommandType.Text, null);
        }
        //Them Hinh Thuc Kiem Tra
        public bool ThemHinhThucKiemTra(ref string err, string MaHTKT, string TenHTKT, float HeSo)
        {
            return db.MyExecuteNonQuery("SpThemHinhThucKiemTra", CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaHTKT", MaHTKT),
                new SqlParameter("@TenHTKT", TenHTKT),
                new SqlParameter("@HeSo", HeSo));
        }
        //Xoa Hinh Thuc Kiem Tra
        public bool XoaHinhThucKiemTra(ref string err, string MaHTKT)
        {
            return db.MyExecuteNonQuery("SpXoaHinhThucKiemTra", CommandType.StoredProcedure, ref err, new SqlParameter("@MaHTKT", MaHTKT));
        }
        //Cap nhat Hinh Thuc Kiem Tra
        public bool CapNhatHinhThucKiemTra(ref string err, string MaHTKT, string TenHTKT, float HeSo)
        {
            return db.MyExecuteNonQuery("SpCapNhatHinhThucKiemTra", CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaHTKT", MaHTKT),
                new SqlParameter("@TenHTKT", TenHTKT),
                new SqlParameter("@HeSo", HeSo));
        }
    }
}
